package com.mzz.structure.proxy.proxysbject;

/**
 *
 * @author xushijian
 * @date 18/5/29 下午6:17
 */
public class Test {

    public static void main(String[] args) {

        //方法一
        Subject subject = new RealSubject();
        Proxy proxy = new Proxy(subject);
        proxy.operate();

        //方法二
        new Proxy(new Subject() {

            Subject subjectTmp = new RealSubject();

            public void operate() {

                System.out.println("start 111");
                subjectTmp.operate();

                System.out.println("end 222");
            }
        }).operate();

    }
}
